﻿using Microsoft.AspNetCore.Mvc;
using Shop.Core.Share;
using Shop.IServices.Admin;
using Shop.Model.View.Admin.Stats;

namespace Shop.AdminApi.Controllers;

/// <summary>
/// 统计服务
/// </summary>
[ApiController]
[Route("admin/[controller]")]
public class StatsController: ShopControllerBase
{
    private readonly IStatsService _statsService;
    private readonly IUserContext _userContext;

    /// <summary>
    /// 
    /// </summary>
    /// <param name="statsService"></param>
    /// <param name="userContext"></param>
    public StatsController(IStatsService statsService,
        IUserContext userContext)
    {
        _statsService = statsService;
        _userContext = userContext;
    }


    /// <summary>
    /// 用户人数统计
    /// </summary>
    /// <returns></returns>
    [HttpGet("UserStats")]
    public AppResult<UserStatsVo> UserStats()
        => _statsService.UserStats();

    /// <summary>
    /// 销售统计
    /// </summary>
    /// <returns></returns>
    [HttpGet("MarketStats")]
    public AppResult<MarketStatsVo> MarketStats()
        => _statsService.MarketStats();

    /// <summary>
    /// 佣金统计
    /// </summary>
    /// <returns></returns>
    [HttpGet("BrokerageStats")]
    public AppResult<BrokerageStatsVo> BrokerageStats()
        => _statsService.BrokerageStats();
}